<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>dumpk3</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="dumpk2.html" title="dumpk2" />
    <link rel="next" href="dumpk4.html" title="dumpk4" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">dumpk3</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="dumpk2.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="dumpk4.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="dumpk3"></a>
      <div class="titlepage"></div>
      <a id="IndexDumpk3" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">dumpk3</span>
        </h2>
        <p>dumpk3 — 
      Periodically writes three orchestra control-signal values to an external file.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp100338704"></a>
        <h2>Description</h2>
        <p>
      Periodically writes three orchestra control-signal values to a named external file in a specific format.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp100380080"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>dumpk3</strong></span> ksig1, ksig2, ksig3, ifilname, iformat, iprd</pre>
      </div>
      <div class="refsect1">
        <a id="idp100381920"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifilname</em></span> -- character string (in double quotes, spaces permitted) denoting the external file name. May either be a full path name with target directory specified or a simple filename to be created within the current directory
    </p>
        <p>
      <span class="emphasis"><em>iformat</em></span> -- specifies the output data format:
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>1 = 8-bit signed char(high order 8 bits of a 16-bit integer</p>
            </li>
            <li class="listitem">
              <p>4 = 16-bit short integers</p>
            </li>
            <li class="listitem">
              <p>5 = 32-bit long integers</p>
            </li>
            <li class="listitem">
              <p>6 = 32-bit floats</p>
            </li>
            <li class="listitem">
              <p>7 = ASCII long integers</p>
            </li>
            <li class="listitem">
              <p>8 = ASCII floats (2 decimal places)</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      Note that A-law and U-law output are not available, and that all formats except the last two are binary. The output file contains no header information.
    </p>
        <p>
      <span class="emphasis"><em>iprd</em></span> -- the period of <span class="emphasis"><em>ksig</em></span> output in seconds, rounded to the nearest orchestra control period. A value of 0 implies one control period (the enforced minimum), which will create an output file sampled at the orchestra control rate.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp100391856"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>ksig1, ksig2, ksig3</em></span> -- control-rate signals
    </p>
        <p>
      This opcode allows three generated control signal values to be saved in a named external file. The file contains no self-defining header information. But it contains a regularly sampled time series, suitable for later input or analysis. There may be any number of <span class="emphasis"><em>dumpk3</em></span> opcodes in an instrument or orchestra but each must write to a different file.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp100394688"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the dumpk3 opcode. It uses the file <a class="ulink" href="examples/dumpk3.csd" target="_top"><em class="citetitle">dumpk3.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp100396544"></a>
          <p class="title">
            <strong>Example 213. Example of the dumpk3 opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac      <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o dumpk3.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

giSine <span class="ohdr">ftgen</span> 0, 0, 2^10, 10, 1

<span class="oblock">instr</span> 1 <span class="comment">;writes three control signals to a file</span>
kfreq     <span class="opc">randh</span>     100, 1, 2, 1, 500 <span class="comment">;generates one random number between 400 and 600 per second</span>
kdb       <span class="opc">randh</span>     12, 1, 2, 1, <span class="op">-</span>12 <span class="comment">;amplitudes in dB between -24 and 0</span>
kpan      <span class="opc">randh</span>     .5, 1, 2, 1, .5 <span class="comment">;panning between 0 and 1</span>
          <span class="opc">dumpk3</span>    kfreq, kdb, kpan, "dumpk3.txt", 8, 1 <span class="comment">;writes the control signals</span>
          <span class="opc">prints</span>    "WRITING<span class="op">:</span>\n"
          <span class="opc">printks</span>   "kfreq <span class="op">=</span> <span class="op">%</span>f, kdb <span class="op">=</span> <span class="op">%</span>f, kpan <span class="op">=</span> <span class="op">%</span>f\n", 1, kfreq, kdb, kpan  <span class="comment">;prints them</span>
<span class="oblock">endin</span>

<span class="oblock">instr</span> 2 <span class="comment">;reads the file written by instr 1</span>
kf,kdb,kp <span class="opc">readk3</span>    "dumpk3.txt", 8, 1
          <span class="opc">prints</span>    "READING<span class="op">:</span>\n"
          <span class="opc">printks</span>   "kfreq <span class="op">=</span> <span class="op">%</span>f, kdb <span class="op">=</span> <span class="op">%</span>f, kpan <span class="op">=</span> <span class="op">%</span>f\n", 1, kf, kdb, kp  <span class="comment">;prints again</span>
kdb       <span class="opc">lineto</span>    kdb, .1 <span class="comment">;smoothing amp transition</span>
kp        <span class="opc">lineto</span>    kp, .1 <span class="comment">;smoothing pan transition</span>
aout      <span class="opc">poscil</span>    <span class="opc">ampdb</span>(kdb), kf, giSine
aL, aR    <span class="opc">pan2</span>      aout, kp
          <span class="opc">outs</span>      aL, aR
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span> 1 0 5
<span class="stamnt">i</span> 2 5 5
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />

      The output should include lines like these:
      </p>
        <pre class="screen">
WRITING:
kfreq = 473.352855, kdb = -15.197657, kpan = 0.366764
kfreq = 473.352855, kdb = -15.197657, kpan = 0.366764
kfreq = 441.426368, kdb = -19.026206, kpan = 0.207327
kfreq = 452.965140, kdb = -21.447486, kpan = 0.553270
kfreq = 585.106328, kdb = -11.903852, kpan = 0.815665
kfreq = 482.056760, kdb = -4.046744, kpan = 0.876537

READING:
kfreq = 473.352900, kdb = -15.197700, kpan = 0.366800
kfreq = 473.352900, kdb = -15.197700, kpan = 0.366800
kfreq = 441.426400, kdb = -19.026200, kpan = 0.207300
kfreq = 452.965100, kdb = -21.447500, kpan = 0.553300
kfreq = 585.106300, kdb = -11.903900, kpan = 0.815700
kfreq = 482.056800, kdb = -4.046700, kpan = 0.876500
      </pre>
        <p>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp100402896"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="dumpk.html" title="dumpk"><em class="citetitle">dumpk</em></a>,
      <a class="link" href="dumpk2.html" title="dumpk2"><em class="citetitle">dumpk2</em></a>,
      <a class="link" href="dumpk4.html" title="dumpk4"><em class="citetitle">dumpk4</em></a>,
      <a class="link" href="readk.html" title="readk"><em class="citetitle">readk</em></a>,
      <a class="link" href="readk2.html" title="readk2"><em class="citetitle">readk2</em></a>,
      <a class="link" href="readk3.html" title="readk3"><em class="citetitle">readk3</em></a>,
      <a class="link" href="readk4.html" title="readk4"><em class="citetitle">readk4</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp100410736"></a>
        <h2>Credits</h2>
        <p>By: John ffitch and Barry Vercoe</p>
        <p>1999 or earlier</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="dumpk2.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="dumpk4.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">dumpk2 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> dumpk4</td>
        </tr>
      </table>
    </div>
  </body>
</html>
